<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0,user-scalable=no,maximum-scale=1,width=device-width">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <title>登录</title>

    <link rel="stylesheet"
          href="http://newstatic.fcdev.pretang.com/fcwap/1.9.0/estate/default/css/style.css?_=0.10486594349821987">
    <link rel="stylesheet"
          href="http://newstatic.fcdev.pretang.com/fcwap/1.9.0/estate/default/css/theme-style.css?_=0.10486594349821987">

    <script type="text/javascript" src="./static/js/base_v3.2.0.js"></script>
    <link rel="stylesheet" href="./static/new_ui/new_css/base_v3.2.css">
    <script type="text/javascript" src="./static/js/modal.js"></script>
    <link rel="stylesheet" href="./static/new_ui/new_css/modal.css">
    <script type="text/javascript" src="./static/js/jquery-1.8.0.min.js"></script>
    <!-- rsa -->
    <script language="JavaScript" type="text/javascript" src="./static/js/rsa/jsbn.js"></script>
    <script language="JavaScript" type="text/javascript" src="./static/js/rsa/prng4.js"></script>
    <script language="JavaScript" type="text/javascript" src="./static/js/rsa/rng.js"></script>
    <script language="JavaScript" type="text/javascript" src="./static/js/rsa/rsa.js"></script>
    <script language="JavaScript" type="text/javascript" src="./static/js/rsa/base64.js"></script>
    <!-- rsa -->
</head>
<body>
<div class="ex-store-box login-bg">
    <div class="login-content clearFix">
        <a href="javascript:history.go(-1);">
            <img class="login-link" src="./static/new_ui/images/login_2.png" width="30px" alt="">
        </a>
        <img class="login-tit" src="./static/new_ui/images/login_text.png" width="150px" alt="">

        <form id="form1">


            <input type="hidden" name="from">
            <input type="hidden" name="openId">


            <div class="login-name">
                <img src="./static/new_ui/images/login_phone.png" width="12px" alt="">
                <input class="in-phone" type="text" name="account" id="mobile" data-name="手机号" placeholder="请输入手机号"
                       value="">
                <img class="del-in none" src="./static/new_ui/images/login_del.png" width="20px" alt="">
            </div>
            <div class="login-name">
                <img src="./static/new_ui/images/login_pass.png" width="15px" alt="">
                <input class="in-phone" id="password" type="password" data-name="密码" placeholder="请输入密码" name="password">
                <!-- <input id="passwordEncode" name="password" type="hidden"> -->
                <img class="del-in none" src="./static/new_ui/images/login_del.png" width="20px" alt="">
            </div>
            <input id="autologin" name="autologin" type="hidden" value="true">

            <div class="other-click clearFix">
                <p class="login-select ">
                    <span class="check-box selected" data-id="245">
                        <i></i>
                    </span>&nbsp;
                    <span class="check-box-name">
                        <a href="javascript:;"></a> 自动登录
                    </span>
                </p>
            </div>
            <a class="login-button" id="register" href="javascript:;">登录</a>


            <table class="register-box clearFix">
                <tbody>
                <tr>
                    <td class="reg-left">
                        可以通过邀请好友，获取更多资金！
                    </td>
                    <td class="reg-right">
                        <a href="userRegist">去注册</a>
                    </td>
                </tr>

                </tbody>
            </table>
        </form>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        //ajax登陆
        $('.login-button').on('click', function (ev) {
            ev.preventDefault();
            $.ajax({
                type:'POST',
                data:{
                   account : $('#mobile').val(), 
                   password : $('#password').val()
                },
                url:'/PuserLogin',
                dataType:'json',
                success: function (msg) {
                    if(msg.msg == 'success'){
                       window.location.href='/isLogin';
                    }
                    else{
                        alert(msg.msg);
                    }
                }
            });
        });
    });
</script>

<script type="text/javascript">
    $(function () {
        $('input[type=text] , input[type=password]').click(function () {
            return false;
        });
        $('input[type=text] , input[type=password]').focus(function () {
            $(".del-in").addClass("none");
            $(this).next('img').removeClass("none");
            return false;
        });
        $('input[type=text],input[type=password]').keyup(function () {
            $(this).next('img').show();
        });
        $(".del-in").on('click', function () {
            $(this).prev('input').val("");
            $(this).hide();
        });
        $(".login-content").click(function () {
            $(".del-in").hide();
        })
    });

    $(function () {

        //登录窗口关闭绑定置业顾问的业务逻辑
        /*   window.clearInterval(winterval);
         window.clearInterval(acceptmsg);*/

        var mark = 0;
        $(".other_oper span:first-child a").on('click', function () {
            if (!mark) {
                $(this).addClass('current');
                $("#autologin").val('true');
                mark++;
            } else {
                $(this).removeClass('current');
                $("#autologin").val('false');
                mark--;
            }
        })

        $("#register").on("touchend", function (e) {
            $("#register").click();
        });
    });


    function validDate() {
        var flag = true;
        var echoText = "";
        var pwdText = $("#password").val().length;
        $.each($(".in-phone"), function (i, ele) {
            var inputVal = $(this).val();
            if (inputVal == "") {
                echoText = $(this).attr("data-name");
                alertMessage(echoText + "不能为空，请重新输入！");
                flag = false;
                return false;
            }
            else {
                echoText = ""
            }
        });
        if (echoText == "") {
            if (!isMobel($("#mobile").val())) {
                alertMessage("手机号码格式不对，请重新输入！");
                flag = false;
                return false;
            }
        }
        if (pwdText != 0) {
            if (pwdText < 6 || pwdText > 15) {
                alertMessage("密码由6-15位字符组成，请重新输入！");
                flag = false;
                return false;
            }
        }

        return flag;
    }
    function isMobel(value) {
        value = $.trim(value);
        if (value.match(/^1[3|4|5|6|7|8]\d{9}$/)) {
            return true;
        } else {
            return false;
        }
    }

    function submitForm() {
        var flag = validDate();
        if (!flag) {
            return;
        }
        $("#passwordEncode").val(encodePassword($("#password").val()));
        var f = $("#form1").serialize();
        var url = "/pwap/hrxfc/userLogin";
        $.post(url, f, function success(data) {
            if (data.success) {
                window.location.href = data.redirect;
            } else {
                alertMessage(data.errorMsg);
            }
        });
    }

    $(function () {
        // 复选框点击
        $(".check-box,.check-box + span").live('click', function () {
            var _this = $(this).hasClass("check-box") ? $(this) : $(this).prev(".check-box");
            if (!_this.hasClass("disabled")) {
                _this.hasClass('selected') ? _this.removeClass('selected') : _this.addClass('selected');
            }
        });
    });
</script>
</body>
</html>